<?php

namespace Common\Lib\Sms;

class ApiEucp extends Api {

    const KEY = 'zm000038897';
    const PASS = 'WQvBrREnDQqegltO';
    const API_URL = "http://sms.pcuu.com/api/send";

    public function __construct() {
        //$this->regist();
    }

    //短信发送接口
    public function send($mobile, $content) {
        $data = array(
            'appid' => self::KEY,
            'appkey' => md5(self::PASS),
            'mobile' => $mobile,
            'content' => $content,
                //'seqid' => 0,
        );

        $url = $this->getUrl() . '?' . http_build_query($data);
//        echo json_encode(array('message'=>$url,'status'=>'error'));exit;
        return file_get_contents($url);
    }

    //短信发送结果接口
    public function response($result) {
        return $result;
    }

    private function regist() {
        $data = array(
            'appid' => self::KEY,
            'appkey' => md5(self::PASS),
        );
        $url = $this->getUrl() . '?' . http_build_query($data);
        file_get_contents($url);
    }

    private function getUrl($url) {
        return self::API_URL . $url;
    }

}